// components/slots/index.js
// 在组件中引用store
import {storeBindingsBehavior} from 'mobx-miniprogram-bindings'
import store from '../../store/index'
let myBehavior = require('../../utils/behavior')
Component({
    /**
     * 组件的属性列表
     */
    behaviors: [storeBindingsBehavior,myBehavior],
    storeBindings: {
        store,
        // fields: {
        //     numA: () => store.numA,
        //     numB: (store) => store.numB,
        //     sum: 'sum'
        // },
        // actions:{
        //     updateNumA: 'updateNumA'
        // }
    },
    methods:　{
        Transfer() {
            this.triggerEvent('Transfer',{str: this.data.str})
        },
        // test() {
        //     console.log('通过父组件调用子组件的方法')
        // }
    },
    options:{
        multipleSlots: true // 在组件定义时的选项中启用多个slot支持
    },
    data:{
        str: '子组件传给父组件的值',
        count: 0
    },
    properties: {
        name: ''
    },
    lifetimes: {
        attached: function() {
            console.log('组件被挂载')
            this.test()
            console.log(this.data.username)
            
        }
    }
})
